package com.flyox.game.militarychess.bean;

import java.io.Serializable;
import java.util.Hashtable;

import com.flyox.game.militarychess.bean.ChessMan.SHOWLEVEL;
import com.flyox.game.militarychess.bean.ChessSeat.SEAT_NAME;

public class ChessDesk implements Serializable {

	private static final long serialVersionUID = -7105365172643967836L;

	public static enum DESK_STATE {EMPTY, PREPARE, PLAYING};
	//
	private int deskNum;// 桌号
	private DESK_STATE deskStates=DESK_STATE.EMPTY;// 空桌，准备，比赛中
	private Hashtable<SEAT_NAME, ChessSeat> seats = new Hashtable<SEAT_NAME, ChessSeat>();
	private SEAT_NAME onTurn=SEAT_NAME.S1;//当前轮到走棋的人
	private SHOWLEVEL showLevel=SHOWLEVEL.PERSONAL;//所有人的查看级别
	
	public ChessDesk(int deskNum) {
		this.deskNum = deskNum;
		// init seat
		seats.put(SEAT_NAME.S1, new ChessSeat(SEAT_NAME.S1));
		seats.put(SEAT_NAME.S2, new ChessSeat(SEAT_NAME.S2));
		seats.put(SEAT_NAME.S3, new ChessSeat(SEAT_NAME.S3));
		seats.put(SEAT_NAME.S4, new ChessSeat(SEAT_NAME.S4));
		seats.put(SEAT_NAME.S5, new ChessSeat(SEAT_NAME.S5));
		seats.put(SEAT_NAME.S6, new ChessSeat(SEAT_NAME.S6));
		seats.put(SEAT_NAME.S7, new ChessSeat(SEAT_NAME.S7));
		seats.put(SEAT_NAME.S8, new ChessSeat(SEAT_NAME.S8));
	}
	
	/**
	 * 是否已开始比赛
	 * @return
	 */
	public boolean isPlaying(){
		if(DESK_STATE.PLAYING.equals(deskStates)){
			return true;
		}else{
			return false;
		}
	}
	public int getDeskNum() {
		return deskNum;
	}

	public void setDeskNum(int deskNum) {
		this.deskNum = deskNum;
	}

	public DESK_STATE getDeskStates() {
		return deskStates;
	}

	public void setDeskStates(DESK_STATE deskStates) {
		this.deskStates = deskStates;
	}

	public Hashtable<SEAT_NAME, ChessSeat> getSeats() {
		return seats;
	}

	public void setSeats(Hashtable<SEAT_NAME, ChessSeat> seats) {
		this.seats = seats;
	}

	public SEAT_NAME getOnTurn() {
		return onTurn;
	}
	public void setOnTurn(SEAT_NAME onTurn) {
		this.onTurn = onTurn;
	}

	public SHOWLEVEL getShowLevel() {
		return showLevel;
	}

	public void setShowLevel(SHOWLEVEL showLevel) {
		this.showLevel = showLevel;
	}
	
	public String toString(){
		return "deskNum="+deskNum+" deskStates="+deskStates+" onTurn="+onTurn.name()+" showLevel="+showLevel;
	}
}
